import { createSlice, Slice } from "@reduxjs/toolkit";
interface UserState {
  userId: number;
  username: string;
  password: string;
  sex: string;
  avatar: string;
  role: number;
  isActive: boolean;
}

export const useUserSlice = createSlice({
  name: "user",
  initialState: {
    userId: "",
    username: "",
    password: "",
    sex: "",
    avatar: "",
    role: "",
    isActive: "",
  },
  reducers: {
    setInfo(state, action) {
      Object.assign(state, action.payload);
    },
  },
});

export const { setInfo } = useUserSlice.actions;
export default useUserSlice.reducer;
